<!DOCTYPE html>
<html>


<!-- Mirrored from www.zi-han.net/theme/hplus/form_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:15 GMT -->
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>统计图表</title>

    <link rel="shortcut icon" href="favicon.ico">
    <link href="../admin/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="../admin/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="../admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="../admin/css/plugins/chosen/chosen.css" rel="stylesheet">
    <link href="../admin/css/plugins/colorpicker/css/bootstrap-colorpicker.min.css" rel="stylesheet">
    <link href="../admin/css/plugins/cropper/cropper.min.css" rel="stylesheet">
    <link href="../admin/css/plugins/switchery/switchery.css" rel="stylesheet">
    <link href="../admin/css/plugins/jasny/jasny-bootstrap.min.css" rel="stylesheet">
    <link href="../admin/css/plugins/nouslider/jquery.nouislider.css" rel="stylesheet">
    <link href="../admin/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
    <link href="../admin/css/plugins/ionRangeSlider/ion.rangeSlider.css" rel="stylesheet">
    <link href="../admin/css/plugins/ionRangeSlider/ion.rangeSlider.skinFlat.css" rel="stylesheet">
    <link href="../admin/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
    <link href="../admin/css/plugins/clockpicker/clockpicker.css" rel="stylesheet">
    <link href="../admin/css/animate.min.css" rel="stylesheet">
    <link href="../admin/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <script src="../admin/js/jquery.min.js?v=2.1.4"></script>
    <!--<script src="../admin/js/plugins/echarts/echarts-all.js"></script>-->
    <script src="../admin/js/plugins/echarts/echarts.js"></script>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-5">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                        <div class="form-group">
                            <input type="file" id="file1" name="file1" class="form-control">
                            <br/>
                            <br/>
                            <br/>
                            <button style="margin-left:50px" id="btn_query"  class="btn btn-primary" onclick="uploadFile()" >上传</button>
                            <button style="margin-left:50px" id="btn_query1"  class="btn btn-primary" onclick="downTemplate()" >下载模板</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

</body>
<script type="text/javascript">
    function downTemplate() {
        window.open("http://localhost:8080/student.xlsx");
    }
    function uploadFile(){
        debugger;
        var fileName=$('#file1').val();
        var suffix = fileName.substring(fileName.lastIndexOf("."));
        if("" == fileName){
            alert("选择需要导入的Excel文件！");
            return false;
        }
        if(".xls" != suffix && ".xlsx" != suffix ){
            alert("选择Excel格式的文件导入！");
            $('#file1').val("");
            return false;
        }
        var formData = new FormData();
        formData.append("myfile",$('#file1')[0].files[0]);
        //formData.append("fileName", fileName);
        $.ajax({
            url: "/chart/importExcel.controller",
            type: "POST",
            data: formData,
            dataType: "text",
            contentType: false,
            processData: false,
            success: function (data) {
                debugger;
                if (data=="s") {
                    alert("上传成功！");
                }
                if (data.status == "f") {
                    alert("上传失败！");
                    return false;
                }
                if (data.status == "n") {
                    alert("请检查数据!!！");
                    return false;
                }
            },
            error: function () {

                alert("上传失败！");
                return false;
            }
        });
    }



</script>
<script src="../admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="../admin/js/content.min.js?v=1.0.0"></script>
<script src="../admin/js/plugins/chosen/chosen.jquery.js"></script>
<script src="../admin/js/plugins/jsKnob/jquery.knob.js"></script>
<script src="../admin/js/plugins/jasny/jasny-bootstrap.min.js"></script>
<script src="../admin/js/plugins/datapicker/bootstrap-datepicker.js"></script>
<script src="../admin/js/plugins/prettyfile/bootstrap-prettyfile.js"></script>
<script src="../admin/js/plugins/nouslider/jquery.nouislider.min.js"></script>
<script src="../admin/js/plugins/switchery/switchery.js"></script>
<script src="../admin/js/plugins/ionRangeSlider/ion.rangeSlider.min.js"></script>
<script src="../admin/js/plugins/iCheck/icheck.min.js"></script>
<script src="../admin/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="../admin/js/plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
<script src="../admin/js/plugins/clockpicker/clockpicker.js"></script>
<script src="../admin/js/plugins/cropper/cropper.min.js"></script>
<script src="../admin/js/demo/form-advanced-demo.min.js"></script>
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
</html>
